<%--
  Created by IntelliJ IDEA.
  User: tugou
  Date: 2017/5/1
  Time: 14:53
  To change this template use File | Settings | File Templates.
--%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form" %>

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page pageEncoding="UTF-8" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no"
          name="viewport" id="viewport">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>报名学员表</title>
    <script src="<%=basePath%>js/jquery.min.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=basePath%>css/main.css">
    <script>
        obj = document.getElementsByName('studentId');
        function allCheck() {
            if ($("#allCheck").is(':checked')) {
                for (var i = 0; i < obj.length; i++) {
                    obj.item(i).checked = true;
                }
            } else {
                for (var i = 0; i < obj.length; i++) {
                    if (obj.item(i).checked) {
                        obj.item(i).checked = false;
                    }
                }
            }
        }
        function itemClick() {
            for (var i = 0; i < obj.length; i++) {
                if (!obj.item(i).checked) {
                    document.getElementById("allCheck").checked = false;
                    break;
                } else {
                    document.getElementById("allCheck").checked = true;
                }
            }
        }
        function exportCommit() {
            var checkValue = "";
            for (var i = 0; i < obj.length; i++) {
                if (obj.item(i).checked) {
                    var itemVal = (obj.item(i).value);
                    checkValue = (checkValue.length == 0) ? itemVal : (checkValue + "," + itemVal);
                }
            }
            if (checkValue.length == 0) {
                alert("请至少选择一项导出");
                return;
            }
            window.open("<%=basePath%>sys/download/" + checkValue);
        }
    </script>
</head>
<body>
<header>

    <h1><a href="./index.html">报名学车管理后台</a></h1>

</header>
<div id="user_nav">
    <a href="<%=basePath%>sys/changePaw"><h1>${sysuser.userName}</h1></a>
    <h2>
        <c:if test="${sysuser.userType == 1}">
            系统管理员
        </c:if>
        <c:if test="${sysuser.userType == 2}">
            运营人员
        </c:if>
    </h2>
    <a href="<%=basePath%>admin/loginOut"><h3>退出</h3></a>
</div>
<div id="sidebar">
    <ul>
        <li><a href="<%=basePath%>sys/index/1"><i class="icon icon_home"></i><span>首页</span></a></li>
        <li><a href="<%=basePath%>sys/userList"><i class="icon icon_users"></i><span>人员管理</span></a></li>
        <li class="active"><a href="#"><i
                class="icon icon_chapter"></i><span>学员信息管理</span></a></li>
        <li><a href="<%=basePath%>sys/examsPage"><i class="icon icon_exams"></i><span>学车点管理</span></a></li>
        <li><a href="<%=basePath%>sys/settingPage"><i class="icon icon_setting"></i><span>网站设置</span></a></li>
    </ul>
</div>
<div id="content">
    <div class="title_h1">
        <h1>学员信息管理</h1>
    </div>
    <form action="" method="post" id="download">
        <input type="hidden" id="parIn" name="parIn">
    </form>
    <form action="<%=basePath%>sys/getStudentList" method="post">
        <div class="search_content">
            <div class="search_time">时间范围：<input class="datatables_search_input" type="date" name="startTime"
                                                 value="${student.createDate}" placeholder="开始时间"> --
                <input class="datatables_search_input" type="date" name="endTime"
                       value="${student.createDate}" placeholder="结束时间"></div>
            <div class="search_time" type="text" style="margin-left: 30px">姓名：<input class="datatables_search_input"
                                                                                     name="userName"
                                                                                     value="${student.userName}"></div>
            <div class="search_time" type="text" style="margin-left: 30px">联系方式：<input class="datatables_search_input"
                                                                                       name="telnum"
                                                                                       value="${student.telnum}"></div>
        </div>
        <div class="search_content">
            <label class="box_silde_label">是否预约学车：</label>
            <select name="bespeak" id="select0" class="box_silde_select">
                <option value="0">全部</option>
                <c:if test="${student.bespeak == 2}">
                    <option value="2" selected="selected">是</option>
                    <option value="1">否</option>
                </c:if>
                <c:if test="${student.bespeak == 1}">
                    <option value="2">是</option>
                    <option value="1" selected="selected">否</option>
                </c:if>
                <c:if test="${student.bespeak == null}">
                    <option value="2">是</option>
                    <option value="1">否</option>
                </c:if>
            </select>
            <label class="box_silde_label">预约地点：</label>
            <select name="locationId" id="select1" class="box_silde_select" title="全部">
                <option value="0">全部</option>
                <c:forEach var="locList" items="${locationList}">
                    <c:if test="${student.locationId == locList.id}">
                        <option value="${locList.id}" selected="selected">${locList.locationname}</option>
                    </c:if>
                    <c:if test="${student.locationId != locList.id}">
                        <option value="${locList.id}">${locList.locationname}</option>
                    </c:if>
                </c:forEach>
            </select>
            <button type="submit">查询</button>
            <button type="button" onclick="exportCommit()">批量导出</button>
        </div>
    </form>
    <div class="setting">
        <div id="datelist">
            <div class="datelist_title">
                <div class="icon_align_justify"></div>
                <h1>学员信息列表</h1>
            </div>
            <table class="datetable">
                <thead>
                <tr>
                    <th><input type="checkbox" id="allCheck" onchange="allCheck()"></th>
                    <th>姓名</th>
                    <th>性别</th>
                    <th>身份证</th>
                    <th>是否预约</th>
                    <th>联系方式</th>
                    <th>预约地点</th>
                    <th>报名时间</th>
                    <th>推荐人</th>
                    <th>免费时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <thead>
                <c:forEach var="stu" items="${studentList}">
                <tr>
                    <th><input type="checkbox" name="studentId" value="${stu.id}" onchange="itemClick()"></th>
                    <input type="hidden" value="${stu.id}">
                    <td>${stu.userName}</td>
                    <td>
                        <c:if test="${stu.sex == 1}">
                            男
                        </c:if>
                        <c:if test="${stu.sex == 2}">
                            女
                        </c:if>
                    </td>
                    <td>${stu.certificatesId}</td>
                    <td>
                        <c:if test="${stu.bespeak == 1}">
                            否
                        </c:if>
                        <c:if test="${stu.bespeak == 2}">
                            是
                        </c:if>
                    </td>
                    <td>${stu.telnum}</td>
                    <td>
                            ${stu.locationName}
                    </td>
                    <td>${stu.createDate}</td>
                    <td>${stu.recommend}</td>
                    <td>${stu.orderTime}</td>
                    <td><a href="<%=basePath%>sys/download/${stu.id}" style="color: #139ff7" target="_blank">下载用户信息</a>
                    </td>
                </tr>
                </c:forEach>
                </tbody>
            </table>
            <!--<div class="datatables_toolbar">
            <div class="datatables_paginat"><a href="#">首页</a><a href="#">上一页</a><a class="active" href="#">1</a><a href="#">2</a><a href="#">3</a><a href="#">下一页</a><a href="#">尾页</a></div>
            </div>-->
        </div>
    </div>
    <footer>© 2014 All Rights Reserved</footer>
</div>
</body>
</html>
